<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <title>{$config.site_title|default='后台登录'}</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta http-equiv="X-UA-Compatible" content="IE=9;IE=8;IE=7;IE=EDGE">
    <meta name="renderer" content="webkit">
    <meta name="keywords" content="{$config.site_keywords|default=''}">
    <meta name="description" content="{$config.site_description|default=''}">
    <link rel="shortcut icon" href="__IMAGES__/favicon.ico" type="image/x-icon"/>
    <link rel="stylesheet" href="__CSS__/oksub.css"/>
    <link rel="stylesheet" href="__CSS__/login.css"/>
</head>
<body>
<div class="login-container">
    <div class="layui-row">
        <div class="layui-col-sm7 layui-col-md7 layui-col-lg7">
            <div class="info">
                <h1>欢迎使用{$config.site_title|default=''}</h1>
                <div class="info-item">
                    <ul>
<!--                        <li>1. 这是一条描述信息！</li>-->
<!--                        <li>2. 这是一条描述信息！</li>-->
                    </ul>
                </div>
            </div>
        </div>
        <div class="layui-col-sm5 layui-col-md5 layui-col-lg5">
            <form class="layui-form login">
                <div class="login_face"><img src="__IMAGES__/logo.png" alt="logo"></div>
                <div class="layui-form-item">
                    <i class="layui-icon layui-icon-username"></i>
                    <input type="text" lay-verify="required" name="username" placeholder="手机号/邮箱" autocomplete="off" id="username" class="layui-input">
                </div>
                <div class="layui-form-item">
                    <i class="layui-icon layui-icon-password"></i>
                    <input type="password" lay-verify="required" name="password" placeholder="密码" autocomplete="off" id="password" class="layui-input">
                </div>
                <div class="layui-form-item captcha">
                    <i class="layui-icon layui-icon-vercode"></i>
                    <input type="text" lay-verify="required" name="captcha" placeholder="验证码" autocomplete="off" id="captcha" class="layui-input">
                    <div><img src="{:url('captcha')}" id="captchaimg" alt="" onclick="this.src='{:url(\'captcha\')}?tm=' + Math.random();" /></div>
                </div>
                <div class="layui-form-item">
                    <button class="layui-btn" lay-submit lay-filter="login">登&emsp;录</button>
                </div>
            </form>
        </div>
    </div>
    <div class="layui-row">
        <div class="layui-col-xs12 copyright">
            {$config.site_copyright|default=''}
            {notempty name='$config.site_icp'}
            &nbsp;|&nbsp;<a href="http://www.beian.miit.gov.cn" target="_blank">{$config.site_icp}</a>
            {/notempty}
        </div>
    </div>
</div>
<!--js逻辑-->
<script src="__LIB__/layui/layui.js"></script>
<script>
    layui.use(["form", "jquery", "okUtils", "okLayer"], function () {
        let form = layui.form;
        let $ = layui.jquery;
        let okUtils = layui.okUtils;
        let okLayer = layui.okLayer;

        /**
         * 表单提交
         */
        form.on("submit(login)", function (data) {
            okUtils.ajax("{:url('Index')}", "post", data.field, true).done(function (response) {
                okLayer.greenTickMsg(response.msg, function () {
                    window.location = "{:url('Index/index')}";
                })
            }).fail(function (error) {
                //console.log(error);
                // 登录失败刷新验证码
                $("#captchaimg").attr("src", "{:url('captcha')}?tm=" + Math.random());
            });
            return false;
        });
    });
</script>
</body>
</html>
